package gui;

import client.ClientControl;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;

public class Windows extends JFrame{
    
    public Windows(){
        setTitle("Todo List");
        this.setSize(800,600);
        this.setLocation(200, 300);
        Container content = this.getContentPane();
        content.setLayout(new BorderLayout());
//        ContentMain content1 = ContentMain.instance;
//        content.add(content1,BorderLayout.CENTER);
        content.add(new Toolbar(), BorderLayout.NORTH);
        content.add(ContentMain.instance, BorderLayout.CENTER);
        content.add(StatusBar.instance, BorderLayout.SOUTH);
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                try {
                    ClientControl.instance.disconnect();
                } catch (RemoteException ex) {
                    Logger.getLogger(Windows.class.getName()).log(Level.SEVERE, null, ex);
                }
            	System.exit(0);
            }
          });
        
        setVisible(true);
    }
}
